const path = require("path");
const Initialize = require("./plugins/initialize.js");
const HtmlWebpackPlugin = require("./plugins/html-webpack-plugin");
const addLoader = require("./loaders/addLoader");
const babelLoader = require("./loaders/babelLoader");
const htmlLoader = require("./loaders/htmlLoader");
const fileLoader = require("./loaders/fileLoader");

module.exports = {
  entry:path.join(__dirname,"./src/js/index.js"),
  output:{
     path:path.join(__dirname,"/dist"),
     filename:"bundle.js"
  },
  module:{
    rules:[{
       test:/\.js/,
       use:[addLoader,babelLoader]
    },{
      test:/\.css/,
      use:[htmlLoader]
    },
    {
      test:/\.(jpg|png|gif)/,
      use:[{
         loader:fileLoader,
         options:{
            outputPath:"./image"
         }
      }]
    }
   ]
  },
  plugins:[
     new Initialize(),
     new HtmlWebpackPlugin({
        template:path.join(__dirname,"./src/index.html"),
        filename:"index.html"
     })
  ]
}